Fix offline release retrieval latency#666
Conversation
…-remediation # Conflicts: # docs/branch-review-ledger.md
Resolved merge conflict in docs/branch-review-ledger.md by keeping all entries from both branches in chronological order.
…n' into codex/release-blocker-remediation
…-remediation # Conflicts: # docs/branch-review-ledger.md
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAgitation search expansion now requires explicit dose or route evidence and retains matching terms. RAG retrieval centralizes telemetry and rejects adversarial queries before Supabase access. Tests and the review ledger record the updated behavior. ChangesOffline retrieval safeguards
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant searchChunksWithTelemetry
participant hasAdversarialManipulationIntent
participant createAdminClient
Caller->>searchChunksWithTelemetry: submit retrieval query
searchChunksWithTelemetry->>hasAdversarialManipulationIntent: inspect query intent
hasAdversarialManipulationIntent-->>searchChunksWithTelemetry: adversarial intent detected
searchChunksWithTelemetry-->>Caller: empty results with refusal telemetry
Note over createAdminClient: no Supabase client is created
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/clinical-search.ts`:
- Line 1254: Align the agitation/arousal medication signal gate and
emitted-token mapping around wantsAgitationArousal with the aliases supported by
buildRetrievalIntent: dosage, mg, mcg, subcutaneous/sc, sublingual/sl,
frequency, and prn in addition to the existing terms. Share a single mapping or
signal definition between these layers so queries such as subcutaneous dosing
and numeric mg amounts retain their supported dose/route intent.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9dde3e25-9189-4e2d-ae49-6724aaf693e0
📒 Files selected for processing (6)
docs/branch-review-ledger.mdsrc/lib/clinical-search.tssrc/lib/rag.tstests/clinical-search.test.tstests/rag-abort-signal.test.tstests/retrieval-query-variants.test.ts
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 1 file(s) based on 1 unresolved review comment. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 1 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Heuristic only — a main-side or flake label is a starting point, not a verdict. |
Static PR checks failed on format:check for a single wrapped assignment. Collapse it so Prettier --check passes and PR required can gate green.
Summary
Why
PR #655 was squash-merged while its provider-free release evaluation was still completing. These three focused follow-ups remove the remaining live offline-route latency failures without changing release thresholds or enabling OpenAI.
Areas touched
src/lib/clinical-search.tssrc/lib/rag.tsVerification
npx vitest run tests/clinical-search.test.ts tests/retrieval-query-variants.test.ts tests/rag-abort-signal.test.ts— 113/113 passed after merging current main.git diff --check origin/main..HEAD— passed.npm run eval:quality:release:offline— passed before sync with no blocking failures; retrieval 26/26, unsupported correctness 100%, citation/numeric/danger failures 0, and 0 model cases, OpenAI request IDs, token usage, nonzero cost, or generation latency.b143d737-b168-49e1-a751-51484d576899— success for9b56eebe4b23ab783207445fb827c317c8d59be8; healthok, OpenAI configskipped.Clinical KB Staging(gdkoelrgjshpjxieaolv).npm run test:cross-tenant:staging— passed all 12 isolation checkpoints; cleanup passed with zero errors on exact head.Checks not rerun locally
verify:pr-local, and aggregate release composites are intentionally left to hosted CI because local runs are flaky and lag-prone..nextroute types were removed, but exceeded a three-minute local timeout. Hosted CI is authoritative.verify:releaseremain deferred, not passed, because this workflow forbids OpenAI API use.Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy); staging evidence used onlyClinical KB Staging(gdkoelrgjshpjxieaolv).Risk and release notes
The changes are limited to query expansion and a fail-closed adversarial retrieval guard. They do not mutate embeddings, chunks, clinical documents, registry metadata, production deployment, or release thresholds. Production registry governance was already reconciled by PR #655 with zero smart-v2 and registry-contract gaps. The repository-approved source-metadata debt remains accepted and was not widened.
Summary by CodeRabbit